fix(@radix-ui/react-menu): Dropdown Scrolling Issue (handle negative offsetY on onPointerMove) #2869
+9
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Issue with video
This video shows a scrolling issue that occurs in dropdown with
max-height
andoverflow: scroll
set.In this video, I never scrolled but only move the mouse pointer near the bottom edge of the dropdown.
2024-04-29.1.14.33.mov
Summary
max-height
andoverflow: scroll
, hovering over an item can trigger dropdown scrolling.onPointerMove
event is triggered for the next item that is out of view(with negative offsetY), causing focus to shift to that item and resulting in continuous scrolling.Solution
onPointerMove
handler inMenuItemImpl
was treatingPointerEvent
withoffsetY < 0
as anentering item
.offsetY < 0
as aleaving item
to prevent the dropdown scroll issue.Testing